import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css
import elementEn from 'element-ui/lib/locale/lang/en'
import elementZh from 'element-ui/lib/locale/lang/zh-CN'
import menuEn from '@/lang/en'
import menuZh from '@/lang/zh'
import App from './App'
import store from './store'
import router from './router'
import VueI18n from 'vue-i18n'
Vue.use(VueI18n)
// 准备翻译的语言环境信息
const messages = {
  en: {

    hello: 'hello world',
    ...elementEn,
    ...menuEn

  },
  ja: {

    hello: 'こんにちは、世界'

  },
  zh: {

    hello: '你好，世界！',
    ...elementZh,
    ...menuZh

  }
}
const i18n = new VueI18n({
  locale: 'ja', // 设置地区
  messages
})

import '@/icons' // icon
import '@/permission' // permission control
import Mymixin from '@/mixin'
Vue.mixin(Mymixin)

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */

// set ElementUI lang to EN
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)
import MyPlugin from '@/components/MyPlugin'
Vue.use(MyPlugin)

Vue.config.productionTip = false
// 单独引入一个过滤器文件
import { formatDate } from '@/filters/index'
Vue.filter('formatDate', formatDate)
// 全部引入过滤器文案件
import * as MyFilter from '@/filters/index'
for (const key in MyFilter) {
  Vue.filter(key, MyFilter[key])
}
new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})

console.log(process.env.VUE_APP_BASE_API)

